// typeindex standard header
#ifndef _TYPEINDEX_
#define _TYPEINDEX_
#include <typeinfo>

 #if _HAS_CPP0X
 #ifndef _XSTD2
  #define _XSTD2	std::
 #endif /* _XSTD2 */

_STD_BEGIN
class type_index
	{	// wraps a typeinfo for indexing
public:
	type_index(const _XSTD2 type_info& _Tinfo) _NOEXCEPT
		: _Tptr(&_Tinfo)
		{	// construct from type_info
		}

	size_t hash_code() const _NOEXCEPT
		{	// return hash value
		return (_Tptr->hash_code());
		}

	const char *name() const _NOEXCEPT
		{	// return name
		return (_Tptr->name());
		}

	bool operator==(const type_index& _Right) const _NOEXCEPT
		{	// test if *this == _Right
		return (*_Tptr == *_Right._Tptr);
		}

	bool operator!=(const type_index& _Right) const _NOEXCEPT
		{	// test if *this != _Right
		return (!(*this == _Right));
		}

	bool operator<(const type_index& _Right) const _NOEXCEPT
		{	// test if *this < _Right
		return (_Tptr->before(*_Right._Tptr));
		}

	bool operator>=(const type_index& _Right) const _NOEXCEPT
		{	// test if *this >= _Right
		return (!(*this < _Right));
		}

	bool operator>(const type_index& _Right) const _NOEXCEPT
		{	// test if *this > _Right
		return (_Right < *this);
		}

	bool operator<=(const type_index& _Right) const _NOEXCEPT
		{	// test if *this <= _Right
		return (!(_Right < *this));
		}

private:
	const _XSTD2 type_info *_Tptr;
	};
_STD_END
namespace std {
	// TEMPLATE STRUCT SPECIALIZATION hash
template<>
	struct hash<type_index>
	{	// hash functor for type_index
	typedef type_index argument_type;
	typedef size_t result_type;

	size_t operator()(const argument_type& _Keyval) const
		{	// hash _Keyval to size_t value by pseudorandomizing transform
		return (_Keyval.hash_code());
		}
	};
}	// namespace std
 #endif /* _HAS_CPP0X */

#endif /* _TYPE_INDEX_ */

/*
 * Copyright (c) by P.J. Plauger. All rights reserved.
 * Consult your license regarding permissions and restrictions.
V6.50:1422 */
